package com.cmc.cloud.cmclink.doc.convert;

import java.util.List;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import com.cmc.cloud.cmclink.doc.api.document.rep.BlnoFreightBaseDto;
import com.cmc.cloud.cmclink.doc.dto.CalFrtRateUnitRespDTO;
import com.cmc.cloud.cmclink.doc.entity.*;
import com.cmc.cloud.cmclink.doc.vo.blnofreightvo.*;
import com.cmc.cloud.cmclink.fin.api.base.dto.req.DocBlnoCreateReqDTO;
import com.cmc.cloud.cmclink.fin.api.base.dto.req.DocBlnoFreightInfoReqDTO;
import com.cmc.cloud.cmclink.fin.api.base.dto.req.DocBlnoVslvoyReqDTO;
import com.cmc.cloud.cmclink.mkt.dto.loc.CalLocReqVo;
import com.cmc.cloud.cmclink.mkt.dto.rate.CalFrtRateUnitRespVo;
import com.cmc.cloud.cmclink.mkt.dto.rate.CalFrtReqVo;

/**
 * 海运费附加费 Convert
 *
 * @author 集运管理员
 */
@Mapper
public interface BlnoFreightConvert {
    /**
     * 获取转换接口的实例
     */
    BlnoFreightConvert INSTANCE = Mappers.getMapper(BlnoFreightConvert.class);

    /**
     * 将创建请求VO转换为DO
     *
     * @param bean 创建请求VO
     * @return DO
     */
    BlnoFreightDO convert(BlnoFreightCreateReqVO bean);

    /**
     * 将更新请求VO转换为DO
     *
     * @param bean 更新请求VO
     * @return DO
     */
    BlnoFreightDO convert(BlnoFreightUpdateReqVO bean);

    /**
     * 将DO转换为查询响应VO
     *
     * @param bean DO
     * @return VO
     */
    BlnoFreightRespVO convert(BlnoFreightDO bean);

    /**
     * 将DO转换为查询响应VO
     *
     * @param bean DO
     * @return VO
     */
    BlnoFreightDO convertFrightDO(BlnoFreightDO bean);

    /**
     * 将DO列表转换为查询响应VO列表
     *
     * @param list DO列表
     * @return VO List
     */
    List<BlnoFreightRespVO> convertList(List<BlnoFreightDO> list);

    /**
     * 将DO列表转换为查询响应VO列表
     *
     * @param list DO列表
     * @return VO List
     */
    List<BlnoFreightCalRespVO> convertFreightList(List<BlnoDO> list);

    /**
     * 将DO列表转换为查询响应VO列表
     *
     * @param list DO列表
     * @return VO List
     */
    List<MultiBlnoFreightRespVO> convertMultiFreightList(List<BlnoDO> list);

    /**
     * CalFrtReqVo
     *
     * @param blnoDO blnoDO
     * @return com.cmc.cloud.cmclink.mkt.dto.rate.CalFrtReqVo
     */
    @Mappings(value = {@Mapping(target = "sid", source = "routeId"),
        @Mapping(target = "agreementNo", source = "agreementNo"), @Mapping(target = "blno", source = "blNo"),
        @Mapping(target = "blnoId", source = "id"), @Mapping(target = "vesselCode", source = "bkgVesselCode"),
        @Mapping(target = "voyage", source = "bkgVoyage"), @Mapping(target = "spaceOwner", source = "spaceOwner"),
        @Mapping(target = "bookingPartyCode", source = "bkpCode"), @Mapping(target = "blEntity", source = "blEntity")})
    CalFrtReqVo convert(BlnoDO blnoDO);

    /**
     * 属性转换
     *
     * @param blnoFreightDoList
     * @return
     */
    List<BlnoFreightBaseDto> convertBlnoFreightBaseDto(List<BlnoFreightDO> blnoFreightDoList);

    /**
     * 属性转换
     *
     * @param list list
     * @return list
     */
    List<BlnoFreightForecastDO> convertFreightForecastList(List<BlnoFreightDO> list);

    /**
     * 属性转换
     *
     * @param blnoDO blnoDO
     * @return list
     */
    @Mappings(value = {@Mapping(target = "blnoId", source = "id"), @Mapping(target = "blno", source = "blNo"),
        @Mapping(target = "porCode", source = "porCode"), @Mapping(target = "delCode", source = "delCode"),
        @Mapping(target = "scno", source = "agreementNo"), @Mapping(target = "spaceOwner", source = "spaceOwner"),
        @Mapping(target = "documentType", constant = "SI")})
    DocBlnoCreateReqDTO convertAccountReq(BlnoDO blnoDO);

    /**
     * 属性转换
     *
     * @param vslvoy vslvoy
     * @return list
     */
    @Mappings(value = {@Mapping(target = "vslCode", source = "vesselCode"),
        @Mapping(target = "imVoy", source = "voyageIm"), @Mapping(target = "exVoy", source = "voyageEx"),
        @Mapping(target = "voyageSeq", source = "routeNo"), @Mapping(target = "transmode", source = "transmode"),
        @Mapping(target = "exLaneCode", source = "laneCodeEx"), @Mapping(target = "imLaneCode", source = "laneCodeIm"),
        @Mapping(target = "polCode", source = "polCode"), @Mapping(target = "podCode", source = "podCode"),
        @Mapping(target = "creator", source = "creator"),
        @Mapping(target = "createTime", source = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss")})
    DocBlnoVslvoyReqDTO convertVslvoyReq(BlnoVslvoyDO vslvoy);

    /**
     * 属性转换
     *
     * @param freight freight
     * @return list
     */
    @Mappings(value = {@Mapping(target = "freightId", source = "id"),
        @Mapping(target = "chargeCode", source = "chargeCode"), @Mapping(target = "chargeCategory", constant = "海运费"),
        @Mapping(target = "currency", source = "currency"), @Mapping(target = "amount", source = "amount"),
        @Mapping(target = "payment", source = "payment"), @Mapping(target = "payerCode", source = "payer"),
        @Mapping(target = "thirdPaidPortCode", source = "thirdPaymentPlace"),
        @Mapping(target = "agreementNo", source = "agreementNo"),
        @Mapping(target = "redFreightId", source = "originalId"), @Mapping(target = "creator", source = "creator"),
        @Mapping(target = "createTime", source = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss")})
    DocBlnoFreightInfoReqDTO convertFreightReq(BlnoFreightDO freight);

    /**
     * 属性转换
     *
     * @param vo vo
     * @return DTO
     */
    CalFrtRateUnitRespDTO convert(CalFrtRateUnitRespVo vo);

    /**
     * 属性转换
     *
     * @param freight freight
     * @return BlnoFreightDetailDO
     */
    BlnoFreightDetailDO convert(BlnoFreightDetailDO freight);

    /**
     * 属性转换
     *
     * @param blnoDO blnoDO
     * @return com.cmc.cloud.cmclink.mkt.dto.rate.CalLocReqVo
     */
    @Mappings(value = {@Mapping(target = "sid", source = "routeId"),
        @Mapping(target = "agreementNo", source = "agreementNo"), @Mapping(target = "blno", source = "blNo"),
        @Mapping(target = "blnoId", source = "id"), @Mapping(target = "vesselCode", source = "bkgVesselCode"),
        @Mapping(target = "voyage", source = "bkgVoyage"), @Mapping(target = "spaceOwner", source = "spaceOwner"),
        @Mapping(target = "bookingPartyCode", source = "bkpCode"), @Mapping(target = "blEntity", source = "blEntity")})
    CalLocReqVo convertCalLocReqVo(BlnoDO blnoDO);
}
